<div class='head'>$lang.get('logs.index.title')</div>

#parse('/widget/widget.message.html')

<div class='tabs'>
	<a href='/admin/logs' class='selected'>$lang.get('a.logs')</a>
</div>

<table id='logs-table' class='tablesorter nospace' border="0" cellpadding="0" cellspacing="1">
	<thead>
		<tr>
			<th>$lang.get('file.name')</th>
			<th>$lang.get('file.size')</th>
			<th>$lang.get('file.updated')</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
#foreach($f1 in $list)
	<tr>
		<td>$!f1.name
			<a href='javascript:;' onclick='_download("$f1.name")' target='_blank' class='icon icon-folder-download' title='/logs/download/$f1.name'></a>
		</td>
		<td>
			#if($f1.isFile())
			$lang.size($!f1.length())
			#end
		</td>
		<td>$!lang.format($f1.lastModified(), 'yyyy-MM-dd HH:mm:ss')</td>
		<td>
			<a class='btn btn-danger btn-xs' href='javascript:;' onclick="_delete('$f1.name', this)">$lang.get('a.delete')</a>
		</td>
	</tr>
#end
	</tbody>
</table>

<iframe id='download' style='display:none'></iframe>

<script>
$('#logs-table').tablesorter({headers:{3:{sorter:false}}});
function _delete(id, o) {
	if(confirm("$lang.get('title.are_u_sure_delete')")) {
		$.post("/admin/logs/delete", {f:id}, function(d){
			$(o).parent().parent().remove();
		})
	}
}
function _download(name) {
	processing && processing.show();
	$.post('/admin/logs/download', {f:name}, function(d){
		processing && processing.hide();
		if(d.state == 200) {
			$('#download').attr('src', d.src);
		} else {
			$.error(d.message);
		}
	})
}

</script>
